<template>
	<el-button @click="onClick" type="primary" class="w-[95px]">登录</el-button>
</template>

<script setup lang="ts">
import LoginForm from './LoginForm.vue'
import { renderDialog } from '@/utils/renderDialog'
import { bus } from '@/utils/eventBus'

let closeFn: () => void
let instanceRef: Ref<typeof LoginForm>

const onClick = () => {
	let { close, instance } = renderDialog(
		LoginForm,
		{},
		{
			title: '用户登录',
			width: '340',
			'close-on-click-modal': false,
		}
	)
	closeFn = close
	instanceRef = instance
}

bus.on('login', onClick)
</script>

<style scoped lang="scss"></style>
